package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCProductEvent;
import com.shrct.businessprocess.product.proxy.RCProductEventProxy;
import edu.fudan.langlab.domain.security.User;
import edu.fudan.langlab.domain.security.impl.UserImpl;
import edu.fudan.mylang.pf.BaseModelObject;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCPRODUCTEVENT_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcproductevent")
public abstract class RCProductEventImpl extends BaseModelObject implements RCProductEvent {
  public RCProductEventImpl() {
    super();
  }
  
  private Date date;
  
  public Date getDate() {
    return this.date;
  }
  
  public RCProductEvent setDate(final Date date) {
    this.date = date;
    return this;			
    
  }
  
  @JoinColumn(name = "operator_id")
  @ManyToOne(targetEntity = UserImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private User operator;
  
  public User getOperator() {
    return this.operator;
  }
  
  public RCProductEvent setOperator(final User operator) {
    this.operator = operator;
    return this;			
    
  }
  
  public RCProductEventProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCProductEventProxy proxy = new com.shrct.businessprocess.product.proxy.RCProductEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
